package com.xxb.common.exception;

import lombok.Getter;

/**
 * @author RenGaoshuai
 * @date 2023/7/6 14:09
 * @description
 */
@Getter
public class ServiceException extends RuntimeException{

    private Integer errCode;

    private String mesg;

    public ServiceException(Integer errCode) {
        this.errCode = errCode;
        this.mesg = SystemErrorEnum.getMesg(errCode);
    }

    public ServiceException(String mesg) {
        this.errCode = SystemErrorEnum.SYSTEM_ERROR.getCode();
        this.mesg = mesg;
    }
    public ServiceException(Integer errCode, String mesg) {
        this.errCode = errCode;
        this.mesg = mesg;
    }

    public ServiceException(SystemErrorEnum systemErrorType) {
        this.errCode = systemErrorType.getCode();
        this.mesg = systemErrorType.getMessage();
    }
}
